package com.hm.jiaowuxitong.dao;

import com.hm.jiaowuxitong.util.DBUtil;

import java.util.List;
import java.util.Map;

public class StudentDaoImp implements IStudentDao {

    @Override
    public int insertStudent(Map<String, Object> oMap) {
        return DBUtil.jt.update("insert into 学生表 values(?,?,?,?,?)",
                new Object[]{

                        oMap.get("personId"),
                        oMap.get("name"),
                        oMap.get("age"),
                        oMap.get("sex"),
                        oMap.get("studyMoney"),
                });
    }

    @Override
    public List<Map<String, Object>> selectStudents() {
        return DBUtil.jt.queryForList("select * from 学生表");
    }
    public List<Map<String, Object>> selectStudents1(String id) {
        return DBUtil.jt.queryForList("select * from 学生表 where 学号=?",id);
    }
    public List<Map<String, Object>> HselectStudent(String id){
        return DBUtil.jt.queryForList("select * from loginStudent where id=?",id);
    }
    public int HinsertStudent(Map<String, Object> oMap) {
        return DBUtil.jt.update("insert into loginTeacher values(?,?)",
                new Object[]{
                        oMap.get("id"),
                        oMap.get("key"),
                });
    }

    public int ChangeStudentPassword(Map<String, Object> oMap) {
        return DBUtil.jt.update("update loginstudent set `key`=? where id=?",
                new Object[]{
                        oMap.get("key"),
                        oMap.get("id"),
                });
    }

}
